﻿Imports System.ComponentModel
Public Class Album
    Implements INotifyPropertyChanged

    Public Event PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs) _
    Implements INotifyPropertyChanged.PropertyChanged

    Private _id As Int64
    Private _name As String '
    Private _location As String '
    Private _photos As Integer '
    Private _title As String '
    Private _description As String '
    Private _previewURL As String '
    Private _geostring As String
    Private _picasaURL As Uri '

    Public Sub New(Optional ByVal url As Uri = Nothing)
        If Not url = Nothing Then Me.PicasaUrl = url
    End Sub

#Region " Public properties "

    Public ReadOnly Property AlbumURL() As Uri
        Get
            If Not _picasaURL = Nothing Then
                Return New Uri(_picasaURL.ToString & "/" & _name)
            Else
                Return Nothing
            End If
        End Get
    End Property

    Public Property PicasaUrl()
        Get
            Return _picasaURL
        End Get
        Set(ByVal value)
            If _picasaURL <> value Then
                _picasaURL = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("PicasaURL"))
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("AlbumURL"))
            End If
        End Set
    End Property

    Public Property ID() As Int64
        Get
            Return _id
        End Get
        Set(ByVal value As Int64)
            If _id <> value Then
                _id = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("ID"))
            End If
        End Set
    End Property

    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            If _name <> value Then
                _name = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Name"))
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("AlbumURL"))
            End If
        End Set
    End Property

    Public Property Location() As String
        Get
            Return _location
        End Get
        Set(ByVal value As String)
            If _location <> value Then
                _location = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Location"))
            End If
        End Set
    End Property

    Public Property Photos() As Integer
        Get
            Return _photos
        End Get
        Set(ByVal value As Integer)
            If _photos <> value Then
                _photos = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Photos"))
            End If
        End Set
    End Property

    Public Property Title() As String
        Get
            Return _title
        End Get
        Set(ByVal value As String)
            If _title <> value Then
                _title = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Title"))
            End If
        End Set
    End Property

    Public Property Description() As String
        Get
            Return _description
        End Get
        Set(ByVal value As String)
            If _description <> value Then
                _description = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Description"))
            End If
        End Set
    End Property

    Public Property PreviewURL() As String
        Get
            Return _previewURL
        End Get
        Set(ByVal value As String)
            If _previewURL <> value Then
                _previewURL = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("PreviewURL"))
            End If
        End Set
    End Property

    Public Property GeoString() As String
        Get
            Return _geostring
        End Get
        Set(ByVal value As String)
            If _geostring <> value Then
                _geostring = value
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("GeoString"))
            End If
        End Set
    End Property

#End Region

End Class
